import 'package:flutter/material.dart';
import 'package:workmate/provider/global.dart';
import 'package:workmate/widget/ico.dart';

class BackWidget extends StatelessWidget {
  const BackWidget({Key? key}) : super(key: key);
  bool canPop(BuildContext context) {
    final NavigatorState navigator = Navigator.of(context);
    return navigator.canPop();
  }

  @override
  Widget build(BuildContext context) {
    return canPop(context)
        ? GestureDetector(
            behavior: HitTestBehavior.opaque,
            onTap: () {
              debugPrint('object\$');
              APP.router.pop(context);
              // Navigator.pop(context);
            },
            child: Container(
                alignment: Alignment.center,
                child: ICO.svg('arrow_left', size: 20, color: Colors.white)),
          )
        : const SizedBox.shrink();
  }
}
